<template>
  <div>
    <ul>
      <li>
        <router-link to="/Contacts/All_conttacts">All_conttacts</router-link>
      </li>
      <li><router-link to="/Contacts/Alice">Alice</router-link></li>
      <li><router-link to="/Contacts/Bob">Bob</router-link></li>
    </ul>
    <button @click="btn">随机显示</button>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: ["/Contacts/All_conttacts", "/Contacts/Alice", "/Contacts/Bob"],
    };
  },
  methods: {
    btn() {
      let num = this.arr[Math.floor(Math.random() * 3)];
      this.$router.push(num);
    },
  },
};
</script>

<style>
.router-link-exact-active {
  color: red;
}
</style>